<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <div>我是div</div>
    <span>我是span</span>
    <script>
      var div = document.querySelector("div");
      //1.nextSibling 下一个兄弟节点 包含元素节点或者 文本节点等
      console.log(div.nextSibling);
      //上一个
      console.log(div.previousSibling);
      //2.等到下一个兄弟元素节点
      console.log(div.nextElementSibling);
      console.log(div.previousElementSibling);
    </script>
  </body>
</html>
